package com.syh.jn.scm.domain.operation.repository.system;

import cn.redscarf.commons.wrapper.Wrapper;
import com.syh.core.ddd.infrastructure.repository.AggregateRepository;
import com.syh.jn.scm.domain.operation.entity.system.OperationRole;
import com.syh.jn.scm.dto.operation.system.menu.OperaMenuVo;
import com.syh.jn.scm.dto.operation.system.permission.PermissionVo;
import com.syh.jn.scm.dto.operation.system.role.OperationRoleVo;

import java.util.List;

public interface OperationRoleRepository extends OperationRoleReadRepository, AggregateRepository<OperationRole, Long> {

  /**
   * @param entity
   * @param updateMenus
   */
  public void update(OperationRole entity, Boolean updateMenus);

  /**
   * @return
   */
  public List<OperaMenuVo> getMenusByRoleId(Long roleId);

  /**
   * @return
   */
  public List<OperaMenuVo> getRoleMenusByWrapper(Wrapper wrapper);

  /**
   * 获取角色所有的权限
   *
   * @return
   */
  public List<OperationRoleVo> getAllRolesWithPermission();

  /**
   * 根据权限查找角色
   *
   * @param perId
   * @return
   */
  public List<OperationRole> getRolesByPermissionId(Long perId);

  /**
   * 根据角色id查找对应权限
   *
   * @param roleId
   * @return
   */
  public List<PermissionVo> getPermissionByRoleId(Long roleId);
}
